package com.foreverwin.mes.lims.service.impl;

import com.foreverwin.mes.core.base.FrontPage;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.foreverwin.mes.core.utils.CommonMethods;
import com.foreverwin.mes.lims.mapper.RetentionSampleMapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.foreverwin.mes.lims.model.RetentionSample;
import com.foreverwin.mes.lims.service.RetentionSampleService;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Mark
 * @since 2020-03-04
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class RetentionSampleServiceImpl extends ServiceImpl<RetentionSampleMapper, RetentionSample> implements RetentionSampleService {


    @Autowired
    private RetentionSampleMapper retentionSampleMapper;

    @Override
    public Page<RetentionSample> selectPage(FrontPage<RetentionSample> frontPage, RetentionSample retentionSample) {
        EntityWrapper<RetentionSample> queryWrapper = new EntityWrapper<>();
        queryWrapper.setEntity(retentionSample);
        return super.selectPage(frontPage.getPagePlus(), queryWrapper);
    }

    @Override
    public List<RetentionSample> selectList(RetentionSample retentionSample) {
        EntityWrapper<RetentionSample> queryWrapper = new EntityWrapper<>();
        queryWrapper.setEntity(retentionSample);
        return super.selectList(queryWrapper);
    }

    @Override
    public List<RetentionSample> selectInventoryBatch(RetentionSample retentionSample) {
        return retentionSampleMapper.selectInventoryBatch(CommonMethods.getSite(),retentionSample.getResource());
    }


}